﻿using System.Collections.Generic;
using Newtonsoft.Json;

namespace TFSRestApiHelper
{
    public class WIQLQueryAtrr
    {
        [JsonProperty("query")]
        public string query;
    }

    public class FlatQueryResult
    {
        [JsonProperty("queryType")]
        public string queryType;
        [JsonProperty("queryResultType")]
        public string queryResultType;
        [JsonProperty("asOf")]
        public string asOf;
        [JsonProperty("columns")]
        public List<QueryColumn> colums;
        [JsonProperty("sortColumns")]
        public List<QuerySortColumn> sortColumns;
        [JsonProperty("workItems")]
        public List<QueryWorkItem> workItems;

        public class QueryColumn
        {
            [JsonProperty("name")]
            public string name;
            [JsonProperty("url")]
            public string url;
        }

        public class QuerySortColumn
        {
            [JsonProperty("field")]
            public FieldSortColumn field;
            [JsonProperty("descending")]
            public bool descending;

            public class FieldSortColumn
            {
                [JsonProperty("referenceName")]
                public string referenceName;
                [JsonProperty("name")]
                public string name;
                [JsonProperty("url")]
                public string url;
            }
        }

        public class QueryWorkItem
        {
            [JsonProperty("id")]
            public int id;
            [JsonProperty("url")]
            public string url;
        }
    }

    //used only for menu
    public class ActiveWIList
    {
        [JsonProperty("count")]
        public int count;
        [JsonProperty("value")]
        public List<ActiveWiListValues> value;

        public class ActiveWiListValues
        {
            [JsonProperty("id")]
            public int id;
            [JsonProperty("rev")]
            public int rev;
            [JsonProperty("fields")]
            public ActiveWiFields fields;
            [JsonProperty("url")]
            public string url;

            public class ActiveWiFields
            {
                [JsonProperty("System.Id")]
                public string System_Id;
                [JsonProperty("System.Title")]
                public string System_Title;
                [JsonProperty("System.WorkItemType")]
                public string System_WorkItemType;
                [JsonProperty("System.TeamProject")]
                public string System_TeamProject;
            }
        }
    }
}
